import Vue from 'vue'
import App from './App3.vue'
import store from './store'

const plu = {
  install(_Vue) {
    _Vue.mixin({
      // 给每一个要渲染的组件 混入了一个 beforeCreate钩子函数
      beforeCreate() {
        console.log(this.$options.nnn)
        if (this.$options.qqq) {
          this.qqq = this.$options.qqq
        } else if (this.$parent && this.$parent.qqq) {
          this.qqq = this.$parent.qqq
        }
      },
    })
  },
  QQ() {
    this.q = 123
    this.w = 456
  }
}
Vue.use(plu)

let p1 = new plu.QQ


let vm = new Vue({
  render: h => h(App),
  store,
  qqq: p1,
  nnn: 'vm'
}).$mount('#app')
console.log(vm)